package com.niiwoo.civet.trade.enums;

import com.niiwoo.civet.base.enums.FeeTypeEnum;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 费用类型mapping还款顺序
 */
@Getter
@AllArgsConstructor
public enum FeeTypeSequenceEnum {

    FIRST(FeeTypeEnum.GUARANTEE_FEE, 1),
    SECOND(FeeTypeEnum.MANAGEMENT_FEE, 2),
    THIRD(FeeTypeEnum.CONSULTING_FEE,3),
    FOURTH(FeeTypeEnum.CAPITAL,4),
    FIFTH(FeeTypeEnum.INTEREST, 5),
    SIX(FeeTypeEnum.PENALTY, 6);

    private final FeeTypeEnum feeTypeEnum;

    private final int sequence;

    public static FeeTypeSequenceEnum enumOf(FeeTypeEnum feeTypeEnum){
        for (FeeTypeSequenceEnum feeTypeSequenceEnum : FeeTypeSequenceEnum.values()) {
            if(feeTypeSequenceEnum.getFeeTypeEnum().equals(feeTypeEnum)){
                return feeTypeSequenceEnum;
            }
        }
        throw new RuntimeException("枚举无法转换");
    }
}
